package cn.com.basespringboot.controller;

import cn.com.basespringboot.bean.User;
import cn.com.basespringboot.service.UserService;
import cn.com.basespringboot.vo.UserVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.sql.Timestamp;


@RestController
public class UserController  {
    @Resource
    private UserService userService;


    @RequestMapping("/addUser")
    public UserVo addUser(){
        User user = new User();
        user.setAge(12);
        user.setUsername("zxy");
        user.setSex(1);
        user.setSalt("djosjioefjiw");
        user.setPassword("4w4");
        user.setBirthdayTime(new Timestamp(System.currentTimeMillis()));
        user.setStartTime(new Timestamp(System.currentTimeMillis()));
        UserVo userVo = userService.addUser(user);
        return userVo;
    }
    @RequestMapping("/getUser")
    public UserVo getUser(){
        UserVo userVo = userService.getUserByName("zxy");
        return userVo;
    }

}
